package demo4;

interface IA{
    void test();
}
public class Test {

    public static void main(String[] args) {
        // final int A = 10;
        int a = 100;
        new IA(){

            // a = 1000;
            @Override
            public void test() {
                System.out.println("重写接口的抽象方法...");
                System.out.println("a = " + a);
            }
        }.test();
    }
    public void func(){
        System.out.println("func()::");
    }
    public static void main4(String[] args) {
        new Test() {
            @Override
            public void func() {
                System.out.println("重写了func的方法...");
            }
        }.func();
    }

    public static void test(){
        // 局部内部类
        class InnerClass{
            public int data1 = 1;
            public int data2 = 2;

            public void test(){
                System.out.println("局部内部类被执行了...");
            }
        }

        InnerClass innerClass = new InnerClass();
        innerClass.test();
    }

    public static void main3(String[] args) {
        test();
    }

    public static void main2(String[] args) {
        OuterClass2.InnerClass innerClass = new OuterClass2.InnerClass();
        innerClass.InnerTest();
    }
    public static void main1(String[] args) {
        OuterClass1 outerClass1 = new OuterClass1();
        OuterClass1.InnerClass innerClass = outerClass1.new InnerClass();
        innerClass.InnerTest();
    }
}
